package org.vacoor.ticket.bean.param.impl;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.vacoor.ticket.bean.TimeRegionType;
import org.vacoor.ticket.bean.param.Parameter;

/**
 * 查询所经过的列车
 * @author vacoor
 *
 */
public class TrainParam implements Parameter{
	private String fromCode;
	private String arriveCode;
	private Date date;
	private TimeRegionType region;
	
	public TrainParam(String fromCode, String arriveCode, Date date, TimeRegionType region) {
		this.fromCode = fromCode;
		this.arriveCode = arriveCode;
		this.date = date;
		this.region = region;
	}

	@Override
	public String getQueryString() {
		return 
			//
			"fromstation=" + fromCode +
			"&tostation=" + arriveCode +
			"&date=" + new SimpleDateFormat("yyyy-MM-dd").format(date) +
			"&starttime=" + region.getValue();
	}

}
